package es.us.lsi.daw.soportePropiedades;

import java.beans.PropertyEditorSupport;

import es.us.lsi.daw.dao.DAOAuthorization;
import es.us.lsi.daw.model.security.Group;

public class GroupEditor extends PropertyEditorSupport{

	private final DAOAuthorization dao;
	
	public GroupEditor(DAOAuthorization dao) {
		super();
		this.dao = dao;
	}
	@Override
	public void setAsText(String text) throws IllegalArgumentException {
		setValue(dao.getGroupFromString(text));		
	}
	
	@Override
	public String getAsText() {
		return ((Group)getValue()).toString();
	}

}
